package com.bsoft.listener;

import com.bsoft.event.NoticeEvent;
import com.bsoft.mapper.business.RegisterMapper;

import com.bsoft.service.RegisterService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import org.springframework.context.ApplicationListener;
import org.springframework.context.event.EventListener;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

//监听类
//@Component
public class NoticeListener implements ApplicationListener<NoticeEvent> {
    private static final Logger log = LoggerFactory.getLogger(NoticeListener.class);

    @Autowired
    private RegisterService registerService;

    @Async("asyncThreadPoolTaskExecutor1")
    @Override
    public void onApplicationEvent(NoticeEvent noticeEvent) {

        Map<String,Object> ss = (Map<String,Object>) noticeEvent.getMessage();
//        System.out.println(ss+",已经成功监听到改事件::"+Thread.currentThread().getName());
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
//        String brdaList = registerService.getBrdaList(ss);
        System.out.println("监听输出::"+ss);
    }
}
